﻿using Jlvier.TaobaoShowcase.Service;
using Taobao.Top.Api.Request;

namespace Taobao.ObjectModel.Request
{
    public class OnSaleItemsRequestWrapper : IProductItemsRequestWrapper
    {
        private readonly ItemsOnsaleGetRequest request;

        public OnSaleItemsRequestWrapper(ItemsOnsaleGetRequest request)
        {
            this.request = request;
            this.request.PageNo = 1;
        }

        public void MoveNext()
        {
            request.PageNo++;
        }

        public Response GetResponse()
        {
            var requestClient = RequestClientFactory.Create();
            var items = requestClient.ItemsOnsaleGet(request);
            APIInvokeMonitor.Instance.Delay();
            APIInvokeMonitor.Instance.Count++;
            return new Response(request,items);
        }
    }
}
